
<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<link rel="stylesheet" href="/resource/kalendae/build/kalendae.css" type="text/css" charset="utf-8">
<!--
<script src="src/moment.js" type="text/javascript" charset="utf-8"></script>
<script src="build/kalendae.js" type="text/javascript" charset="utf-8"></script>
-->
<script src="/resource/kalendae/build/kalendae.activity.js" type="text/javascript" charset="utf-8"></script>

<style type="text/css" media="screen">
/** 表格样式 **/
.datesel { background-color: #eee; display: inline-block; width: 480px;border: 1px solid  #e5e5e5;  }
.tbcal { width: 100%;  }
.tbcal .left { width: 30%; }
.tbcal .right{ position: relative; width: 70%;  }
.kalendae .k-days span.closed {
	background:red;
}
.datesel .left .time { padding-left: 20px; color: #898989; font-size: 14px; }
.datesel .left .time input { display: block; width: 134px; height: 40px; background: #fff url(/resource/www/imgs/date_icon.png) no-repeat 10px 6px; padding-left: 40px; }

.kalendae .k-calendar { width: 290px; }
.k-title { position: relative; }
.k-title .k-caption { position: relative; top: 0px ; }
.kalendae .k-title, .kalendae .k-header, .kalendae .k-days { width: 266px; text-align: center; margin: 0 auto; }
.kalendae .k-days span { background: #fff; width: 34px; height: 34px; line-height: 34px; text-align: center; padding: 0; margin: 2px; }
.kalendae .k-header span {  width: 36px; height: 36px; line-height: 36px; text-align: center; }

.kalendae .k-caption {  font-weight: bold; font-size: 18px;   color: #262626;}

.tbcal .mulcal {  width: 290px; position: relative;}

.kalendae .k-days span.k-in-month,
.kalendae .k-days span.k-out-of-month { background: #ccc; color: #fff; }
.kalendae .k-days span.k-in-month.k-active { background: #fff; color: #444; }
.kalendae .k-days span.k-selected.k-active {  background: #2cda98; color: #fff; }
</style>

<div class="base-banner-wrap">
    <img src="<{$track.bannerUrl}>" class="base-banner">
</div>

<div class="huod_lux fix">

    <div class="main">
        <h2 class="title" title="<{$track.name}>"><{$track.name}></h2>
        <div class="user-info fix">

            <div class="left">
                <img src="<{$track.guider.userIcon}>" class="img">
            </div>
            <div class="right">
                <div class="one">
                    <strong class="name"><{$track.guider.realName}></strong>
                    <{if  $track.guider.identityActive == 1}>
                    <img src="/resource/www/imgs/correct_icon.png" class="yiyz">
                    <span class="text">身份已验证</span>
                    <{/if}>
                    <{if  $track.guider.telActive == 1}>
                    <img src="/resource/www/imgs/correct_icon.png" class="yiyz">
                    <span class="text">电话已验证</span>
                    <{/if}>
                </div>
                <div class="two">
                    <span class="local"> 居住地：<{$track.guider.resideCity}> </span>
                </div>
                <div class="two">
                    <span class="time">居住时间：<{$track.guider.resideTime}></span>
                </div>
                <div class="sex-banner">
                 <{if $track.guider.userAge}>
                   <span class="data-lable"> <{$track.guider.userAge}></span>
                 <{/if}>
                   <span class="data-lable"> <{if $track.guider.userGender == 'm'}>男<{else}>女<{/if}></span>
                 <{if $track.guider.identityName}>
                   <span class="data-lable"> <{$track.guider.identityName}></span>
                 <{/if}>
                </div>
                <div class="school-banner">
                 <{if $track.guider.identityErea_zhuanye}>
                   <span class="data-lable"> <{$track.guider.identityErea_zhuanye}>专业</span>
                 <{/if}>
                 <{if $track.guider.identityErea_school}>
                   <span class="data-lable"> <{$track.guider.identityErea_school}></span>
                 <{/if}>      
                </div>
                <p class="four"><{$track.guider.introduction|@nl2br}></p>
            </div>
        </div>

        <h3 class="subtitle">路线信息</h3>

        <div class="info-box">
            <p class="line fix">
                <span class="span">出行方式</span>
                <{if $track.trafficSupportCar == '1'}><em class="fs">私家车</em><{/if}>
                <{if $track.trafficSupportBus == '1'}><em class="bus">公共交通</em><{/if}>
            </p>
            <p class="line fix">
                <span class="span">可接待人数</span>
                <em class="number"><{$track.serviceMaxPersons}>人</em>
            </p>
            <p class="line fix">
                <span class="span">行程天数</span>
                <em class="tian"><{$track.days}>天</em>
            </p>
            <p class="line fix">
                <span class="span">路线描述</span>
                <em class="txt"><{$track.summary|@nl2br}></em>
            </p>
        </div>
        <a href="/track/detail_days/<{$track.id}>" target="_blank">
<div class="xingchengdetail">
<img class="xcd-bg" src="/resource/www/imgs/xingchengdetail-button.png">
<div class="xcd-shadow"><span>查看行程详情</span><img src="/resource/www/imgs/xingchengdetail-icon.png"></div>
</div>
</a>

        <h3 class="subtitle panchor">价格</h3>

        <div class="info-box" style="position:relative;overflow:hidden;">
            <div style="position:absolute;bottom: 0px;width:900px;height: 115px;background-color:#fff;z-index: 10;"></div>
            <img src="/resource/images/priceicon-line.png" style="position:absolute;top:20px;left:76px;">

            <ul class="hang">
                <li class="li">
                    <p class="p fix">
                        <span class="span">餐饮</span>
                        <em class="cy"><{$track.priceFood/100}>€/ 人</em>
                    </p>
                    <p class="p fix">
                        <span class="span">费用描述</span>
                        <em class="wenz"><{$track.descFood|@nl2br}></em>
                    </p>
                    <div class=tongjibar percent=<{$tongji.food}> style="background-color:rgb(35,159,134)"><div style="position:relative;left:-50px;color:rgb(35,159,134)"><{$tongji.food}>%</div></div>
                </li>

                <li class="li">
                    <p class="p fix">
                        <span class="span">交通</span>
                        <em class="jt"><{$track.priceTraffic/100}>€/ 人</em>
                    </p>
                    <p class="p fix">
                        <span class="span">费用描述</span>
                        <em class="wenz"><{$track.descTraffic|@nl2br}></em>
                    </p>
                    <div class=tongjibar percent=<{$tongji.traffic}> style="background-color:rgb(253,154,63)"><div style="position:relative;left:-50px;color:rgb(253,154,63)"><{$tongji.traffic}>%</div></div>
                </li>
                <li class="li">
                    <p class="p fix">
                        <span class="span">票务</span>
                        <em class="piaow"><{$track.priceTicket/100}>€/ 人</em>
                    </p>
                    <p class="p fix">
                        <span class="span">费用描述</span>
                        <em class="wenz"><{$track.descTicket|@nl2br}></em>
                    </p>
                    <div class=tongjibar percent=<{$tongji.ticket}> style="background-color:rgb(48,129,183)"><div style="position:relative;left:-50px;color:rgb(48,129,183)"><{$tongji.ticket}>%</div></div>
                </li>
                <li class="li">
                    <p class="p fix">
                        <span class="span">其他费用</span>
                        <em class="other"><{$track.priceOther/100}>€/ 人</em>
                    </p>
                    <p class="p fix">
                        <span class="span">费用描述</span>
                        <em class="wenz"><{$track.descOther|@nl2br}></em>
                    </p>
                    <div class=tongjibar percent=<{$tongji.other}> style="background-color:rgb(239,62,99)"><div style="position:relative;left:-50px;color:rgb(239,62,99)"><{$tongji.other}>%</div></div>
                </li>
                <li class="li">
                    <p class="p fix">
                        <span class="span">服务费用</span>
                        <em class="fuw"><{$track.priceService/100}> € </em>
                    </p>
                    <p class="p fix">
                        <span class="span">费用描述</span>
                        <em class="wenz">服务费用是除固定旅行成本(餐饮、交通、票务等)外给予玩伴的费用，其中包括陪游、讲解、行程安排和咨询等服务，价格不会随游客人数浮动</em>
                    </p>
                    <div class=tongjibar percent=<{$tongji.service}> style="background-color:rgb(207,197,182)"><div style="position:relative;left:-50px;color:rgb(207,197,182)"><{$tongji.service}>%</div></div>
                </li>
            </ul>
        </div>

        <h3 class="subtitle" style="margin-bottom: 0;">评价</h3>
        <{if $counts == 0}>
        <span class="no-pj"> 暂无评价 </span>
        <{else}>
        <ul class="commentlist">
            <{foreach from=$comments item=v}>
            <li class="li fix">
                <div class="left">
                    <img src="<{$v.userIcon}>" class="img">
                </div>
                <div class="right">
                    <p class="one">
                        <{$v.userName}>
                        <span class="date"><{$v.created}></span>
                    </p>
                    <p class="two">
			<{$v.comments}>
			<div class="imgs">
                		<{foreach from=$v.tourist_pic item=j}>
                    			<a target="_blank" href="<{$j}>"><img src="<{$j}>"></a>
                		<{/foreach}>
			</div>
		    </p>
                </div>
            </li>
            <{/foreach}>

        </ul>
        <a href="/track/get_more/2?id=<{$track.id}>" next="2" onclick="return false" id="get_more" class="get-more-pj">查看更多评价</a>
        <{/if}>

    </div>
    <div class="sidebar">
        <form action="/order/add/track" method="POST" onSubmit="return form_submit_track(this)">
        <h3 class="title" title="<{$track.name}>"><{$track.name}></h3>
        <ul class="timebox fix">
            <li class="li">
                <p class="p">开始时间</p>
                <input class="input" name="startDay" id="start" >
            </li>
            <li class="li">
                <p class="p">结束时间</p>
                <input name="stopDay" class="input" id="end">
            </li> <input type="hidden" name="goodsId" value="<{$track.id}>">
            <li class="li">
                <p class="p">人数</p>
                <select name="persons" class="input" onchange="zongjia_changed(this)">
                    <{foreach from=$personList item=countPerson}>
	                <option value="<{$countPerson}>"><{$countPerson}> 位游客</option>
                    <{/foreach}>
                </select>
            </li>
        </ul>
        <h2 class="zongj"> 总价: <strong class="strong"><{$track.priceTotal/100*1.1|round:2}></strong> € </h2>
        <{if $global_user.userUid > 0}>
            <input class="shenq" type="submit" name="submit" value="申请预约" onclick="return submit_huod_lux();" >
            <{/if}>
        </form>
        <{if $global_user.userUid > 0}>
        <a href="/chat/with/<{$track.uid}>" onclick="return contact()" class="lianx-dy">联系玩伴</a>
        <{else}>
        <a class="shenq" onclick="showBox($('.login-wrap'), $('.alert-bg'));$('body,html').animate({scrollTop:0},0);">登录后申请预约</a>
        <{/if}>
    </div>

</div>
<script type="text/javascript">
var sidebarOY=$("div.sidebar").offset().top;
var sidebarOX=$("div.sidebar").offset().left;;

$(window).scroll(function(){
            var sidebarY = sidebarOY-$(this).scrollTop();
              if(sidebarY<=0){
            $("div.sidebar").css({"position":"fixed","top":10,"left":sidebarOX});
            }else if(sidebarY>0){
            $("div.sidebar").css({"position":"static","float":"left"});
           }});
           //layer.msg("滚动了");});

$(".xingchengdetail").mouseover(function(){
          $(".xcd-shadow").show();

});
$(".xingchengdetail").mouseout(function(){
          $(".xcd-shadow").hide();
});

var anchorY=$(".panchor").offset().top;
var showtimes=0;
var barW=0;
$(window).scroll(function(){
	if($(this).scrollTop()>=anchorY && showtimes==0){
		showtimes++;
		$(".tongjibar").each(function(){
			barW=$(this).attr('percent')/100*280;
			$(this).animate({width:barW},1200);
		});
	}
})
</script>
<script>
function form_submit_track(formItem)
{
    <{if $track.uid == $global_user.userUid}>
        layer.tips("导游不能对自己的路线下单", formItem);
        return false;
    <{else}>
        return true;
    <{/if}>
}
</script>
<script>
    function contact(){
    <{if $track.uid == $global_user.userUid}>
        layer.msg("不能联系自己");
        return false;
    <{else}>
        return true;
    <{/if}>

    }

    $(function() {
        var more = $("#get_more");
        more.click(function(){
            var url = more.attr("href");

            $.ajax({
                type : "get",
                url : url,
                success : function(response) {
//                    console.log(response);
                    if(response){
                        $('.commentlist').append(response);
                        var next = more.attr('next');
                        var next_url = '/track/get_more/'+(++next)+'?id='+<{$track.id}>;
                        more.attr('href',next_url);
                        more.attr('next',next);
                    }else{
                        more.hide();

                    }

                }
            });
        });
    });
</script>

<script>

function submit_huod_lux() {
    var ostartDay = $("input[name='startDay']").val();
    if (!$.trim(ostartDay)) {
        layer.msg('请输入开始时间');
        return false;
    }
    var oStopDay = $("input[name='stopDay']").val();
    if (!$.trim(oStopDay)) {
        layer.msg('请输入结束时间');
        return false;
    }

    if (! checkDays())
    {
        return false;
    }


    var oPersons = $("select[name='persons']").val();
    var oNumberReg =  /^[0-9]*[1-9][0-9]*$/;
    if (!$.trim(oPersons) || !oNumberReg.test($.trim(oPersons)) ) {
        layer.msg('请输入正确的人数');
        return false;
    }
}


var global_kal = null;
var guiderFreeDays   = [
    <{foreach from=$guiderFreeDays item=day}>
    '<{$day}>',
    <{/foreach}>
];
function getWeeklyDatesBetweenDays (day1, day2, wDay)
{
    if (wDay == '周日')
        iW = 0;
    else if (wDay == '周一')
        iW = 1;
    else if (wDay == '周二')
        iW = 2;
    else if (wDay == '周三')
        iW = 3;
    else if (wDay == '周四')
        iW = 4;
    else if (wDay == '周五')
        iW = 5;
    else if (wDay == '周六')
        iW = 6;

    d1 = new Date(day1);
    d2 = new Date(day2);
    dx = d1;
    i  = 0;

    global_kal.setSelected();

    for (; dx.getTime() <= d2.getTime(); i = i + 1 )
    {
        if (dx.getDay() == iW)
        {
            global_kal.addSelected(dx.toDateString());
        }

        dx.setTime(dx.getTime() + 86400000);
    }

    global_kal.draw();
}

var global_kal = null;
var global_kal2 = null;

$(document).ready(function () {

		global_kal = new Kalendae.Input('start', {
            attachTo: document.getElementById("start"),
			months:1,
            weekStart: 1,
			mode:'single',
            useYearNav: false,
            columnHeaderFormat: "dd",
            titleFormat: "YYYY年MM月",
            format: 'YYYY-MM-DD',
            disableNextMonth: true,
            blackout : function (x) {

                for (var i in guiderFreeDays)
                {
                    var x1 = Kalendae.moment(guiderFreeDays[i]);
                    var x2 = Kalendae.moment(guiderFreeDays[i]);
                    x2.add(1, 'days');
                    if (x.isBetween(x1, x2))
                        return false;
                }

                return true;

                var d1 = Kalendae.moment('<{$track.startDay}>');
                var d2 = Kalendae.moment('<{$track.stopDay}>');
                d2.add(1, 'days');
                if (x.isBetween(d1, d2))
                    return false;
                else
                    return true;
            },
            'subscribe' : {
                'date-clicked' : function (date) {
                    var nextDate = Kalendae.moment(date);
                    nextDate.add(<{$track.days}> - 1, 'days');
                    global_kal2.setSelected(nextDate);
                }
            },
		});

		global_kal2 = new Kalendae.Input('end', {
            attachTo: document.getElementById("end"),
			months:1,
            weekStart: 1,
			mode:'single',
            useYearNav: false,
            columnHeaderFormat: "dd",
            titleFormat: "YYYY年MMM",
            format: 'YYYY-MM-DD',
            disableNextMonth: true,
            blackout : function (x) {

                for (var i in guiderFreeDays)
                {
                    var x1 = Kalendae.moment(guiderFreeDays[i]);
                    var x2 = Kalendae.moment(guiderFreeDays[i]);
                    x2.add(1, 'days');
                    if (x.isBetween(x1, x2))
                        return false;
                }

                return true;


                for (var i in orderDays)
                {
                    var x1 = Kalendae.moment(orderDays[i]);
                    var x2 = Kalendae.moment(orderDays[i]);
                    x2.add(1, 'days');
                    if (x.isBetween(x1, x2))
                        return true;
                }

                var d1 = Kalendae.moment('<{$activity.startDay}>');
                var d2 = Kalendae.moment('<{$activity.stopDay}>');
                d2.add(1, 'days');
                if (x.isBetween(d1, d2))
                    return false;
                else
                    return true;
            },

            'subscribe' : {
                'date-clicked' : function (date) {
                }
            },
		});



        if (guiderFreeDays.length > 0)
        {
            global_kal.viewStartDate = Kalendae.moment(guiderFreeDays[0]);
            global_kal.draw();

            global_kal2.viewStartDate = Kalendae.moment(guiderFreeDays[0]);
            global_kal2.draw();
        }
});

function checkDays ()
{
    var d1 = global_kal.getSelected();
    var d2 = global_kal2.getSelected();
    if ( Kalendae.moment(d1).isAfter(d2))
    {
        layer.msg('开始时间应该小于结束时间');
        return false;
    }

    var countsValid = 0;
    for (var i in guiderFreeDays)
    {
        var x1 = Kalendae.moment(guiderFreeDays[i]);
        if (x1.isSame(d1) || x1.isSame(d2))
            countsValid += 1;
        if (x1.isAfter(d1) &&  x1.isBefore(d2))
            countsValid += 1;
    }

    if (countsValid != <{$track.days}>)
    {
        layer.msg('您所选的行程日期内包含无效日期，请重新选择');
        return false;
    }

    return true;
}

function zongjia_changed (selitem)
{
    var persons = $(selitem).val();
    //var price   = <{$track.priceTotal/100}>;
    //var days    = <{$track.days}>;
    var pService= <{$track.priceService/100}>;
    var pFee    = <{$track.priceFood/100}> + <{$track.priceTraffic/100}> + <{$track.priceOther/100}> + <{$track.priceTicket/100}>;
    
    var money   = (pService + pFee * persons)*1.1;
     money = money.toFixed(2);
    $('.zongj strong').html(money);
}


</script>

<{include file="www/footer.tpl"}>
